# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

# W0232: 15,0:ContentHelper: Class has no __init__ method
# pylint: disable=W0232
class ContentHelper:
  content_extensions = {
    '.html'    : 'text/html',
    '.jpg'     : 'image/jpeg',
    '.gif'     : 'image/gif',
    '.png'     : 'image/png',
    '.js'      : 'application/x-javascript',
    '.css'     : 'text/css',
    '.manifest': 'text/cache-manifest',
    '.zip'     : 'application/zip' }

  @staticmethod
  def content_type_from_path(path):
    _, extension = os.path.splitext(path)
    return ContentHelper.content_extensions.get(extension, 'text/plain')

def from_path(path):
  return ContentHelper.content_type_from_path(path)
